package com.pattern.decorator;

/**
 * @author 冯志立
 * @create 2019-10-30 10:31
 */
public class Decorator extends Drink {
    private Drink obj;

    public Decorator(Drink obj) {  //组合关系
        this.obj = obj;
    }

    @Override
    public float cost() {
        //先拿到自己的价格
        return super.getPrice() + obj.cost();
    }

    @Override
    public String getDes() {
        //obj.getDes()输出被装饰者的信息
        return super.des+" "+ super.getDes() + "&&" + obj.getDes();
    }
}
